﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestConsole
{
    public class TestAttribute : Attribute
    {
        // Private fields.
        private string name;
        private string level;
        private bool reviewed;

        // This constructor defines two required parameters: name and level.

        public TestAttribute(string name, string level)
        {
            this.name = name;
            this.level = level;
            this.reviewed = false;
        }

        // Define Name property.
        // This is a read-only attribute.

        public virtual string Name
        {
            get { return name; }
        }

        // Define Level property.
        // This is a read-only attribute.

        public virtual string Level
        {
            get { return level; }
        }

        // Define Reviewed property.
        // This is a read/write attribute.

        public virtual bool Reviewed
        {
            get { return reviewed; }
            set { reviewed = value; }
        }
    }
    [AttributeUsage(AttributeTargets.Class, Inherited =false)]
    public class SaveAttribute : Attribute
    {
        public bool IsSave { get; set; }
        public SaveAttribute(bool isSave)
        {
            IsSave = isSave;
        }

        public object GetInstance()
        {
            return this;
        }
    }

    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
    public class Save2Attribute : Attribute
    {
        public bool IsSave { get; set; }
        public Save2Attribute(bool isSave)
        {
            IsSave = isSave;
        }

        public object GetInstance()
        {
            return this;
        }
    }

    [Save(true)]
    public class TestClass2
    {
        public int MyProperty { get; set; }
        [Save2(true)]
        public int MyProperty1 { get; set; }
        public string MyProperty2 { get; set; }
    }

    public class TestClass3 : TestClass2
    {
        
    }
}
